﻿using AutoMapper;
using B.MES.FLH.WarehouseManagement.Application;
using B.MES.FLH.WarehouseManagement.Application.Dtos.Definition;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Standard;

namespace B.MES.FLH.WarehouseManagement.Controllers
{
    /// <summary>
    /// 仓库定义控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class WareHouseDefinitionController : ControllerBase
    {
        private readonly IService service;

        public WareHouseDefinitionController(IService service)
        {
            this.service = service;
        }
        /// <summary>
        /// 仓库定义添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("CreateWAREHOUSEDEFINITIONMODEL")]
        public ApiResult<int> CreateWAREHOUSEDEFINITIONMODEL(CreateWarehouseDefinitionModelInput input)
        {
            return service.CreateWAREHOUSEDEFINITIONMODEL(input);
        }
        /// <summary>
        /// 仓库定义删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost("DeleteWAREHOUSEDEFINITIONMODEL")]
        public ApiResult<int> DeleteWAREHOUSEDEFINITIONMODEL(string id)
        {
            return service.DeleteWAREHOUSEDEFINITIONMODEL(id);
        }
        /// <summary>
        /// 仓库定义修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("UpdateWAREHOUSEDEFINITIONMODEL")]
        public ApiResult<int> UpdateWAREHOUSEDEFINITIONMODEL(UpdateWarehouseDefinitionModelInput input)
        {
            return service.UpdateWAREHOUSEDEFINITIONMODEL(input); 
        }
        /// <summary>
        /// 仓库定义查询
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        [HttpGet("GetWAREHOUSEDEFINITIONMODEL")]
        public ApiPaging<WarehouseDefinitionModelOutput> GetWAREHOUSEDEFINITIONMODEL([FromQuery]PageWareHouseDefinition page)
        {
            return service.GetWAREHOUSEDEFINITIONMODEL(page);
        }
        /// <summary>
        /// 仓库定义详情
        /// </summary>
        [HttpGet("GetWAREHOUSEDEFINITIONDESC")]
        public ApiResult<WarehouseDefinitionDescOutput> GetWAREHOUSEDEFINITIONDESC([FromQuery]string id)
        {
            return service.GetWAREHOUSEDEFINITIONDESC(id);
        }
        /// <summary>
        /// 仓库定义下拉框
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetWarehouseDefinitionIdAndName")]
        public ApiResult<List<GetWarehouseDefinitionIdAndName>> GetWarehouseDefinitionIdAndName()
        {
            return service.GetWarehouseDefinitionIdAndName();
        }
}
}
